package utstat;

import static utstat.Team.blue;
import static utstat.Team.red;

import java.util.HashMap;
import java.util.Map;

public class UtEvent {

    private int time;
    private Type type;
    private String src;
    private String dest;
    private Weapon weapon;
    private BodyPart bodyPart;
    private int score;
    private int round;
    private String map;
	private Team team;
	private Map<String, Team> playerTeams;
	private String command;
	private String message;

  

	public Map<String, Team> getPlayerTeams() {
		return playerTeams;
	}

	public UtEvent(int time, Type type, String src, String dest,
            Weapon weapon, BodyPart bodyPart, int round, String map,Team team, Map<String, Team> playerTeams) {
        this.time = time;
        this.type = type;
        this.src = src;
        this.dest = dest;
        this.weapon = weapon;
        this.bodyPart = bodyPart;
        this.round = round;
        this.map = map;
        this.team = team;
        this.playerTeams = new HashMap<String, Team>();
        this.playerTeams.putAll(playerTeams);
    }

    public UtEvent(int time, Type type, String src, int score, int round, String map, Team team, Map<String, Team> playerTeams) {
        this.time = time;
        this.type = type;
        this.src = src;
        this.score = score;
        this.round = round;
        this.map = map;
        this.team = team;
    }

    public UtEvent(int time, Type type, String src, Team team, int currentRound, String currentMap) {
    	  this.time = time;
          this.type = type;
          this.src = src;
          this.team = team;
          this.round = currentRound;
          this.map = currentMap;
	}

	public UtEvent(Type type) {
		this.type=type;
	}

	public UtEvent(String src2, String message) {
		this.type = Type.command;
		this.src = src2;
		this.message = message;
	}

	@Override
    public String toString() {
        return time + "|" + type + "|" + src + "|" + dest + "|" + weapon + "|"
                + bodyPart + "|" + round + "|" + map + "|" + score;
    }

    public int getTime() {
        return time;
    }

    public Type getType() {
        return type;
    }

    public String getSrc() {
        return src;
    }

    public String getDest() {
        return dest;
    }

    public Weapon getWeapon() {
        return weapon;
    }

    public BodyPart getBodyPart() {
        return bodyPart;
    }

    public int getScore() {
        return score;
    }

    public int getRound() {
        return round;
    }

    public String getMap() {
        return map;
    }
    public Team getTeam() {
		return team;
	}

	public Team getEnemyTeam() {
		if(team==null) return null;
		return team==blue?red:blue;
	}

	public String getCommand() {
		return command;
	}

	public String getMessage() {
		return message;
	}
}
